package com.njworkorder.Service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.njworkorder.Entity.ApRole;
import com.njworkorder.Service.ApRoleService;
import com.njworkorder.Mapper.ApRoleMapper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
* @author iron
* @description 针对表【ap_role】的数据库操作Service实现
* @createDate 2025-03-21 17:17:09
*/
@Service
public class ApRoleServiceImpl extends MPJBaseServiceImpl<ApRoleMapper, ApRole>
    implements ApRoleService{

    @Async
    @Override
    public CompletableFuture<List<ApRole>> getApRoleByApId(String apId) {
        LambdaQueryWrapper<ApRole> queryWrapper = new LambdaQueryWrapper<ApRole>()
                .eq(ApRole::getApId, apId);
        return CompletableFuture.completedFuture(list(queryWrapper));
    }

    @Async
    @Override
    public CompletableFuture<Long> getApRoleCountByApId(String apId) {
        LambdaQueryWrapper<ApRole> wrapper = new LambdaQueryWrapper<ApRole>()
                .eq(ApRole::getApId, apId);
        return CompletableFuture.completedFuture(count(wrapper));
    }
}




